import request from '../utils/request';
import {service_host} from './config';

export async function addTestRecord(params) {
    return request(`${service_host}/testrecord/add`, {
        method: 'POST',
        body: params
    });
}

export async function deleteTestRecord(id) {
    return request(`${service_host}/testrecord/delete`, {
        method: 'DELETE',
        body: {id: id}
    });
}

export async function updateTestRecord(params) {
    return request(`${service_host}/testrecord/update`, {
        method: 'POST',
        body: params
    });
}

export async function getRecordList(params) {
    return request(`${service_host}/testrecord/activeList`, {
        method: 'POST',
        body: params
    });
}

export async function pmCheckPass(testrecordId) {
    return request(`${service_host}/testrecord/pmCheckPass`, {
        method: 'POST',
        body: {id: testrecordId}
    });
}

export async function pmCheckFail(params) {
    return request(`${service_host}/testrecord/pmCheckFail`, {
        method: 'POST',
        body: params
    });
}

export async function testCheckPass(testrecordId) {
    return request(`${service_host}/testrecord/testCheckPass`, {
        method: 'POST',
        body: {id: testrecordId}
    });
}

export async function testCheckFail(params) {
    return request(`${service_host}/testrecord/testCheckFail`, {
        method: 'POST',
        body: params
    });
}

export async function queryActiveRecord(versionId) {
    return request(`${service_host}/testrecord/active`, {
        method: 'POST',
        body: {versionId}
    });
}

export async function queryTestRecord(testrecordId) {
    return request(`${service_host}/testrecord/info`, {
        method: 'POST',
        body: {id: testrecordId}
    });
}

export async function queryTestCount(pname) {
    return request(`${service_host}/testrecord/getTestCount`, {
        method: 'POST',
        body: {pname: pname}
    });
}

export async function querySuccessRate(pname) {
    return request(`${service_host}/testrecord/getSuccessRate`, {
        method: 'POST',
        body: {pname: pname}
    });
}

